#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    vector<int> findAnagrams(string s, string p) {
        if (p.size() > s.size())
            return {};
        vector<int> v;
        for (int left = 0, right = p.size() - 1; right < s.size(); right++) {
            int hashi[26] = { 0 };
            for (auto e : p) {
                hashi[e - 'a']++;
            }
            while (left <= right) {
                hashi[s[left] - 'a']--;
                left++;
            }
            bool flag = true;
            for (int i = 0; i < 26; i++) {
                if (hashi[i]) {
                    flag = false;
                    break;
                }
            }
            if (flag == true) {
                v.emplace_back(right - p.size() + 1);
            }

            left = right - p.size() + 2;
        }
        return v;
    }
};